import { S } from '../../s';
import { IPSControl } from '../ipscontrol';
import { IPSDBAppMenuPortletPart } from './ipsdbapp-menu-portlet-part';
import { PSDBPortletPartImpl } from './psdbportlet-part-impl';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';

export class PSDBAppMenuPortletPartImpl
  extends PSDBPortletPartImpl
  implements IPSDBAppMenuPortletPart
{
  get aMListStyle(): string {
    return this.M.aMListStyle;
  }

  protected ampssyspfplugin: IPSSysPFPlugin;
  getAMPSSysPFPlugin(): IPSSysPFPlugin | null {
    return (
      this.ampssyspfplugin ||
      (this.ampssyspfplugin = this.fillObjectModel(
        S._27c,
        this.M.getAMPSSysPFPlugin,
        S._33d,
      ) as IPSSysPFPlugin)
    );
  }

  get codeName(): string {
    return this.M.codeName;
  }

  protected contentpscontrol: IPSControl;
  getContentPSControl(): IPSControl | null {
    if (this.contentpscontrol != null) return this.contentpscontrol;
    const value = this.M.getContentPSControl;
    if (value == null) {
      return;
    }
    this.contentpscontrol = this.findPSControl(value);
    return this.contentpscontrol;
  }

  get portletType():
    | 'LIST'
    | 'CHART'
    | 'VIEW'
    | 'HTML'
    | 'TOOLBAR'
    | 'ACTIONBAR'
    | 'CUSTOM'
    | 'APPMENU'
    | 'CONTAINER'
    | 'RAWITEM' {
    return this.M.portletType;
  }

  get title(): string {
    return this.M.title;
  }
  get cls(): string {
    return 'PSDBAppMenuPortletPartImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._224) return true;
    return super.instanceof(cls);
  }
}
